package com.qianfeng.gl4study.youshare.acitivity.store;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import com.qianfeng.gl4study.youshare.R;
import com.qianfeng.gl4study.youshare.fragments.StorePlatformFragment;
import com.qianfeng.gl4study.youshare.utils.Constants;

/**
 * 点击平台产品分类，进入分类子分类和分类商品列表
 * Created with IntelliJ IDEA.
 * I'm glad to share my knowledge with you all.
 * User:Gaolei
 * Date:2015/2/7
 * Email:pdsfgl@live.com
 */
public class SubCategoryActivity extends FragmentActivity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_sub_category);

		//点击平台产品分类进入该界面，传递点击分类的Id，更新StorePlatformFragment的设计，使其动态获取列表
		Intent intent = getIntent();
		String cid = intent.getStringExtra(Constants.INTENT_KEY_CSTEGOTY_ID);
		if(cid == null){
			cid = "2";
		}
		FragmentManager fragmentManager = getSupportFragmentManager();

		//开启事务
		FragmentTransaction transaction = fragmentManager.beginTransaction();
		StorePlatformFragment fragment = new StorePlatformFragment();

		//设置子分类Id，用于显示特定分类下的内容
		Bundle args = new Bundle();

		//设置子分类ID
		args.putString(Constants.ARG_SUB_CATEGORY_ID,cid);

		fragment.setArguments(args);

		transaction.add(R.id.sub_category_container, fragment);

		transaction.commit();


	}
}